<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        switch (a = new Date().getDay()) {
            case a = 1:
                document.write("星期一");
                break;
            case a = 2:
                document.write("星期二");
                break;
            case a = 3:
                document.write("周三");
                break;
            default:
                document.write("不是周一周二周三");
        }

        var num = 300;
        if (num > 300) {
            alert('num >300');
        } else if (num > 0) {
            alert('num > 0 ');
        } else {
            alert('error');
        } 

        // undefined null nan都不会执行 相当于false
        if(!null){console.log('null不会执行');}
        if(!undefined)console.log('undefined不会执行');
        if(!NaN)console.log('nan不会执行');

    </script>

    <script>
        //冒泡排序法
        var arr2 = [80, 10, 15, 20, 33, 32222, 313];
        function maopao(arr) {
            //外层控制两两比较的次数 length-1次
            for (var a = 1; a < arr.length; a++) {
                //内层直接按顺序两两比较 大的往右走 每一次后参与两两比较的数都会少一次
                for (var b = 0; b <= arr.length - 1 - a; b++) {
                    if (arr[b] > arr[b + 1]) {
                        var temp;
                        temp = arr[b];
                        arr[b] = arr[b + 1];
                        arr[b + 1] = arr[b];
                    }
                }
            }
            return arr;
        }

        document.writeln(maopao(arr2))

    </script>
</head>

<body>

</body>

</html>